Only auto-delete manually installed DLLs if also replacing them #4024
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Problem
If you manually install a module that contains a plugin that matches the "main" module's identifier but which has been separated into a separate module (e.g.,
NearFutureSolar
andNearFutureSolar-Core
, which installsNearFutureSolar.dll
), the main module will be detected as manually installed and can be upgraded to have CKAN take control of it, and theCore
module will be installed automatically as a dependency, but theCore
module's DLL will be deleted during the installation and missing afterwards.Workaround: A right-click reinstall of the
Core
module restores the DLL.Causes
I found two specific bugs related to this:
Registry.installed_dlls
is only supposed to contain files that aren't registered to any installed module, but if you have CKAN take ownership of any of these files via upgrading, they aren't removed from it, which can confuse code that handles manually installed files.ModuleInstaller.InstallModule
's DLL handling block has a check that is supposed to cover this case (the comment referencesNearFutureElectrical
andNearFutureElectrical-Core
), but it doesn't actually skip the deletion if the DLL is missing from the module. It's also affected by the above bug where the DLL remains in the manually installed list after it's registered as CKAN-installed.The net effect is that CKAN deletes
NearFutureSolar.dll
during the install ofNearFutureSolar
, after it is replaced byNearFutureSolar-Core
.Changes
Registry.installed_dlls
(this would have fixed the bug by itself)
(this also would have fixed the bug by itself)
Fixes #4018.